﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.Composition;
using Roslyn.Compilers.CSharp;
using RoslynCompiler.MEF;
using Roslyn.Compilers.Common;

namespace WeakEvent
{
    class WeakEventCodeRewriter
    {
        [Export(typeof(ICodeRewriter))]
        public class NotifyPropertyChangedCodeRewriter : ICodeRewriter
        {
            public SyntaxNode Rewrite(SyntaxNode originalNode, int rewriterIndex, ISemanticModel semanticModel)
            {
                switch (rewriterIndex)
                {
                    case 0:
                        return new WeakEventRewriter(semanticModel).Visit(originalNode);
                }
                return originalNode;
            }

            public int RewriterCount
            {
                get { return 1; }
            }
        }
    }
}
